package 算法.图.util;

/**
 * 【有向图：带权重的边】
 * 		
 * @Date   2017-09-04 10：19
 * @author Administrator
 * @version 
 */
public class DirectedEdge implements Comparable<DirectedEdge> {
	//起点
	private final int v;			
	//重点
	private final int w;
	//权重
	private final double weight;
	
	public DirectedEdge(int v, int w, double weight) {
		super();
		this.v = v;
		this.w = w;
		this.weight = weight;
	}
	
	
	public int from() {
		return v;
	}


	public int to() {
		return w;
	}

	public double getWeight() {
		return weight;
	}

	@Override
	public String toString() {
		return "DirectedEdge [v=" + v + ", w=" + w + ", weight=" + weight + "]";
	}


	@Override
	public int compareTo(DirectedEdge that) {
		if	   (this.weight < that.weight)	return -1;
		else if(this.weight > that.weight)	return  1;
		else 								return  0;
	}
	
}
